package animation;

import main.pak.R;
import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.MotionEvent;
import android.widget.ImageView;

public class DrawableAnimationTree extends Activity  {
	
	AnimationDrawable treeAnimation;
	
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.image_views);
		
		ImageView treesView = (ImageView) findViewById(R.id.imageview);
		treesView.setBackgroundResource(R.drawable.frame);
		treeAnimation = (AnimationDrawable) treesView.getBackground();
	}
	
	public boolean onTouchEvent(MotionEvent event){
		if(event.getAction() == MotionEvent.ACTION_DOWN){
			treeAnimation.start();
			return true;
		}
		return super.onTouchEvent(event);
	}
	
}
